package processes;

import to.MaterialTO;
import to.ProductTO;
import util.DateUtil;
import util.MaterialParser;
import util.ProductParser;

public class PressingMachine extends Machine{
	public PressingMachine(MachineManager machineManager, String machineId) {
		super(800, 400, machineManager, machineId);
		setLineName("Pressing Machine");
	}
	
	@Override
	public void beforeManufacture() {
	}
	
	@Override
	public void afterManufacture() {
		currentProduct.setPressingQuality(generateQuality());
		currentProduct.setPressingDate(DateUtil.getInstance().getCurrentTimeString());
		currentProduct.setPressingId(getMachineId());
		currentProduct.setPressingTime((int)(DateUtil.getInstance().getCurrentTimeLong()-getStartTime()));
		ProductParser pp = ProductParser.getInstance();
		pp.writeProduct(machineManager.getNextDir(), currentProduct);
	}
}
